﻿using System.Web.Optimization;

namespace FutureApp.Web
{
    public static class BundleConfig
    {
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.IgnoreList.Clear();

            //VENDOR RESOURCES
            RegisterVerdorBundles(bundles);
            RegisterThemeBundles(bundles);

            //PLUGINS RESOURCES
            bundles.Add(new ScriptBundle("~/plugins/bootstarptable/js")
                .Include("~/Assets/plugins/bootstrap-table/bootstrap-table.js")
                .Include("~/Assets/plugins/bootstrap-table/bootstrap-table-locale-all.js")
                .Include("~/Assets/plugins/bootstrap-table/bootstrap-table-fixer.js")
                .Include("~/Assets/plugins/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js")
                .Include("~/Assets/plugins/bootstrap-table/extensions/key-events/bootstrap-table-key-events.js")
                .Include("~/Assets/plugins/bootstrap-table/extensions/search/bootstrap-table-advanced-search.js")
                .Include("~/Assets/plugins/bootstrap-table/extensions/search/bootstrap-table-advanced-search-locale-all.js")
                .Include("~/Assets/plugins/bootstrap-table/extensions/inline-control/bootstrap-table-inline-control.js")
                .Include("~/Assets/plugins/bootstrap-list-modal/bootstrap-list-modal.js")
                .Include("~/Assets/plugins/chosen/chosen.jquery.js")
            );
            bundles.Add(new StyleBundle("~/plugins/bootstarptable/css")
                .Include("~/Assets/plugins/bootstrap-table/bootstrap-table.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/chosen/chosen.css", new CssRewriteUrlTransform())
            );

            //APPLICATION RESOURCES
            bundles.Add(new ScriptBundle("~/app/js")
                .Include("~/Assets/scripts/main.js")
            );
            bundles.Add(new StyleBundle("~/app/css")
                .Include("~/Assets/styles/main.css", new CssRewriteUrlTransform())
            );
        }

        private static void RegisterThemeBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/hplus/js")
                .Include("~/Assets/plugins/jquery/jquery.slimscroll.js")
                .Include("~/Assets/plugins/metisMenu/metisMenu.js")

                .Include("~/Assets/plugins/hplus/hplus.js")
                .Include("~/Assets/plugins/hplus/contabs.js")
                .Include("~/Assets/plugins/pace/pace.js")
            );
            bundles.Add(new StyleBundle("~/hplus/css")
                .Include("~/Assets/plugins/hplus/hplus.css", new CssRewriteUrlTransform())
            );
        }

        private static void RegisterVerdorBundles(BundleCollection bundles)
        {
            bundles.Add(new StyleBundle("~/verdor/css")
                .Include("~/Assets/plugins/font-awesome/font-awesome.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/simple-line-icons/simple-line-icons.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/bootstrap/bootstrap.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/animate/animate.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/sweetalert/sweetalert.css", new CssRewriteUrlTransform())
                .Include("~/Assets/plugins/flags/famfamfam-flags.css", new CssRewriteUrlTransform())

                //自定义
                .Include("~/Assets/plugins/app/app.css", new CssRewriteUrlTransform())
            );
            bundles.Add(new ScriptBundle("~/verdor/js")
                .Include("~/Assets/plugins/other/json2.js")
                .Include("~/Assets/plugins/jquery/jquery.js")
                .Include("~/Assets/plugins/underscore/underscore.js")
                .Include("~/Assets/plugins/bootstrap/bootstrap.js")
                .Include("~/Assets/plugins/layer/layer.js")
                .Include("~/Assets/plugins/sweetalert/sweetalert.js")
                .Include("~/Assets/plugins/other/moment-with-locales.js")
                .Include("~/Assets/plugins/spin/moment-with-locales.js")
                .Include("~/Assets/plugins/spin/spin.js")
                .Include("~/Assets/plugins/spin/jquery.spin.js")
                .Include("~/Assets/plugins/jquery/jquery.blockUI.js")
                .Include("~/Assets/plugins/artTemplate/template.js")

                .Include("~/Assets/framework/scripts/abp.js")
                .Include("~/Assets/framework/scripts/utils/ie10fix.js")
                .Include("~/Assets/framework/scripts/libs/abp.jquery.js")
                .Include("~/Assets/framework/scripts/libs/abp.spin.js")
                .Include("~/Assets/framework/scripts/libs/abp.blockUI.js")
                .Include("~/Assets/framework/scripts/libs/abp.sweet-alert.js")

                //自定义
                .Include("~/Assets/plugins/app/app.js")
                .Include("~/Assets/plugins/app/extension.js")
            );
            bundles.Add(new ScriptBundle("~/verdor/shiv")
                .Include("~/Assets/plugins/shiv/html5shiv.js")
                .Include("~/Assets/plugins/shiv/respond.js")
            );
        }
    }
}